{% load avatar_tags seahub_tags i18n %}

{% for notice in notices %}
    {% if notice.seen %}
    <li class="read">
    {% else %}
    <li class="unread" data-id="{{notice.id}}">
    {% endif %}

    {% if notice.msg_from %}
        <a href="{% url 'user_profile' notice.msg_from %}">{% avatar notice.msg_from 32 %}</a>
    {% else %}
        <img src={{notice.default_avatar_url}} width="32" height="32" class="avatar" />
    {% endif %}

    {% if notice.is_group_msg %}
        <p class="brief">{{ notice.format_group_message_title|safe }}</p>
        {% if notice.format_group_message_detail %}
        <p class="clear cspt detail">{{ notice.format_group_message_detail }}</p>
        {% endif %}
    {% elif notice.is_grpmsg_reply %}
        <p class="brief">{{ notice.format_grpmsg_reply_title|safe }}</p>
        {% if notice.format_grpmsg_reply_detail %}
        <div class="clear cspt detail">
            {% if notice.format_grpmsg_reply_topic %}
            <p class="topic">{{ notice.format_grpmsg_reply_topic|truncatechars:35 }}</p>
            {% endif %}
            <p>{{ notice.format_grpmsg_reply_detail }}</p>
        </div>
        {% endif %}
    {% elif notice.is_user_message %}
        <p class="brief">{{ notice.format_user_message_title|safe }}</p>
        {% if notice.format_user_message_detail %}
        <p class="clear cspt detail">{{ notice.format_user_message_detail }}</p>
        {% endif %}

    {% elif notice.is_file_uploaded_msg %}
        <p class="brief">{{ notice.format_file_uploaded_msg|safe }}</p>

    {% elif notice.is_repo_share_msg %}
        <p class="brief">{{ notice.format_repo_share_msg|safe }}</p>

    {% elif notice.is_priv_file_share_msg %}
        <p class="brief">{{ notice.format_priv_file_share_msg|safe }}</p>

    {% elif notice.is_group_join_request %}
        <p class="brief">{{ notice.format_group_join_request|safe }}</p>
    {% endif %}

        <p class="time">{{ notice.timestamp|translate_seahub_time }}</p>
    </li>
{% endfor %}
